package com.ruoyi.config;

import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;

import org.jasypt.encryption.StringEncryptor;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;

@Component
@Slf4j
@AllArgsConstructor
public class SpringBootConfigEncrypt implements CommandLineRunner {


    private StringEncryptor encryptor;

    @Override
    public void run(String... args) {
        String mongoDbUsername = "root";
        String mongoDbPassword = "kys@123#zxw";
        String pgUsername = "postgres";
        String pgPassword = "kys@123#zxw";

        log.info("-------DataBase Password start------");
        log.info("mongoUsername:{}",encryptor.encrypt(mongoDbUsername));
        log.info("mongoPassword:{}",encryptor.encrypt(mongoDbPassword));
        log.info("pgUsername:{}",encryptor.encrypt(pgUsername));
        log.info("pgPassword:{}",encryptor.encrypt(pgPassword));
        log.info("-------DataBase Password end------");

    }
}